package common

import (
	. "go-caipu/pkg/services/sqlstore/migrator"
)

func AddLoginAttemptMigrations(mg *Migrator) {
	loginAttempt := Table{
		Name: "sys_login_attempt",
		Columns: []*Column{
			{Name: "id", Type: DB_BigInt, IsPrimaryKey: true, IsAutoIncrement: true},
			{Name: "username", Type: DB_NVarchar, Length: 32, Nullable: true},
			{Name: "ipaddress", Type: DB_NVarchar, Length: 64, Nullable: false},
			{Name: "created", Type: DB_BigInt, Length: 32, Nullable: true},
		},
		Indices: []*Index{
			{Cols: []string{"username", "ipaddress"}, Type: UniqueIndex},
		},
	}
	//create table
	mg.AddMigration("create sys_login_attempt table", NewAddTableMigration(loginAttempt))
}
